package fb4java.beans;


import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;


public class Note {
    public long noteId;
    public String title;
    public String content;
    public Date createdTime;
    public Date updatedTime;
    public long userId;
    public String contentHtml;

    public Note() {
    }

    public Note(JSONObject obj) throws JSONException {
        initByJSONObject(obj);
    }

    public void initByJSONObject(JSONObject obj) throws JSONException {
        noteId = obj.getLong("note_id");
        title = obj.getString("title");
        content = obj.getString("content");
        createdTime = new Date(obj.getLong("created_time") * 1000);
        updatedTime = new Date(obj.getLong("updated_time") * 1000);
        userId = obj.getLong("uid");
        contentHtml = obj.getString("content_html");
    }
}
